/* Copyright (C) 2008, 2009, 2010, Faindu GmbH, Switzerland.
* All Rights Reserved. The following is Source Code and is subject to all restrictions 
* on such code as contained in the license accompanying this project. */
package blocstac.api.blocbox
{
	import flash.display.Bitmap;
	import flash.utils.ByteArray;
	

/**
 * Interface for ImageLoader.
 */
public interface ImageLoader
{
	//----------------------------------
	//  url
	//----------------------------------	
	/**
	 * This is the url of the image.
	 */	
	function get url(): String
	
	//----------------------------------
	//  image
	//----------------------------------		
	/**
	 * This is the original bitmap of the image.
	 */
	function get image(): Bitmap
	
	//----------------------------------
	//  bytes
	//----------------------------------		
	/**
	 * If the image has been changed on the client side, the 
	 * encoded image is stored in bytes.
	 */
	function get bytes():ByteArray
	
	//----------------------------------
	//  fromUrl
	//----------------------------------		
	/**
	 * Only image of the format jpg, png or gif are allowed. 
	 * Setting the <code>url</code> immediatelly starts loading the image. 
	 * <p>The alternative to loading from an URL is handing in directly a bimap 
	 * into <code>showBitmap</code>.</p>
	 * 
	 * @see fromBitmap()
	 */
	function fromUrl(url:String): void

	//----------------------------------
	//  fromBitmap
	//----------------------------------
	/**
	 * Instead of assigning an url, a bitmap can be used in EditImage.
	 * 
	 * @param bitmap The bitmap to display in EditImage
	 * @param url Optionally, you can provide the URL of the image. The <code>url</code>
	 * is not used for loading an image, the value is only stored. 
	 * 
	 * @see fromUrl()
	 */
	function fromBitmap( bitmap:Bitmap, url:String=null ): void
	
	//----------------------------------
	//  clone
	//----------------------------------		
	/**
	 * Returns a clone of <code>EditImage</code>. The image is cloned but no manipulations. To clone 
	 * the manipulations, use the following code:
	 * <listing version="3.0" >var clonedEditImage: IEditImage = editImage.clone()
	 * clonedEditImage.imageManipulations.imageEdits = editImage.imageManipulations.imageEdits</listing>
	 */
	function clone(): ImageLoader
	
}
}